****************
****************
* Replication file for Rival Claims by Bethany Lacina
* Univ of Michigan Press, 2017
* Fig 3.1 & Chapter 8
****************
****************

use Chp8_replication.dta, clear

global controls2 s1popsh sthindupc s1distmsh st_litratio lnst_population st_urpc ldist 

****************
****************
* States over time
* Fig 3.1
****************
****************
preserve
gen st_population=exp(lnst_population)
gen inmajstate=0
replace inmajstate=st_population if s1popsh>50 & statetype!=3 & statetype!=5

gen statecounter=0
replace statecounter=1 if statetype!=3 & statetype!=5

collapse (sum) statecounter st_population inmajstate, by(year)

gen inmajstatesh=inmajstate/st_population*100

expand 2 if year==2014, gen(mark)

replace year=2015 if mark==1

replace statecounter=29 if year==2015

sort year
gen label=.
replace label=statecounter if statecounter!=statecounter[_n-1]

twoway (line inmajstatesh year) ///
(spike statecounter year) ///
(scatter label year, ms(i) mlabel(label) mlabpos(12)), ///
name(Fig3_1, replace) ///
ytitle("Percent of pop./Number of states") xtitle("")  ///
xlabel(1950 1955(10)2015) ///
legend(order( 2 "% of India's population in states with majority languages" ///
 - "Vertical bars display total number of states") pos(6) rows(3))

restore

****************
****************
* States with and without violent autonomy movements
****************
****************

*Figure 8.1
preserve 
collapse (count) s1seat, by(mybin stips_01)
twoway (bar s1 mybin if stips==0, barw(0.8)) ///
(bar s1 mybin if stips==1, barw(0.8)) ///
, name(Fig8_1, replace) ///
ytitle("Number of state-year observations") ///
xtitle("Largest ethnic group seats as % PM's coalition") ///
legend(lab(1 "No violent" "autonomy movement") lab(2 "Violent" "autonomy movement")) yscale(log) ylabel(1 10 100 1000, nogrid)
restore
 
* Table 8.1, Model 5
logit stips_01 s1seats $controls2 stips_01py* if statetype!=3 & statetype!=5, vce(robust)

****************
****************
* State discrimination
****************
****************

*Figure 8.2
gen crescale=civilexamdisc*100
gen srescale=secondarydisc*100

twoway ///
(lpoly srescale year, yaxis(1) lp(solid))  ///
(lpoly crescale year, yaxis(1) lp(solid) lc(gs12)) ///
,  name(Fig8_2, replace) ///
xlabel(1960(10)2010) ///
ylabel(25(25)75, axis(1)) ///
xtitle("") ytitle("Percent of states", axis(1)) ///
legend(order(1 "Secondary education discrimination (smoothed)" ///
2 "Civil service exam discrimination (smoothed)") ///
pos(6) rows(2)) 

*Table 8.1, Model 6
xi: logit secondarydisc s1seats $controls2 lnyrs_nos i.secondarycommissioner if statetype!=5, vce(robust)

*Table 8.1, Model 7
xi: logit civilexamdisc s1seats $controls2 lnyrs_noc i.civilserviceexamcommissioner if statetype!=5, vce(robust)
